package servlet;

import bean.Student;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/queryServlet")
public class QueryServlet extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws SecurityException, IOException, ServletException {
        List<Student> studentList = new ArrayList<>();
        studentList.add(new Student("001","蔡","男"));
        studentList.add(new Student("002","浩","男"));
        studentList.add(new Student("003","天","男"));

        request.setAttribute("result",studentList);
        request.getRequestDispatcher("show.jsp").forward(request,response);

    }

}
